package com.shop.controller;

import com.shop.entity.Result;
import com.shop.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/search")
public class SearchController {
    @Autowired
    private SearchService searchService;

    /**
     * 全文检索
     * @param parmMap
     * @return
     * @throws Exception
     */
    @PostMapping("/select")
    public Result search(@RequestBody Map<String,String> parmMap) throws Exception {
        Map search = searchService.search(parmMap);
        return new Result("查询成功",search);
    }
}
